1 /*
2  * Copyright (c) 2011-2014 - Mauro Carvalho Chehab
3  * Copyright (c) 2012 - Andre Roth <neolynx@gmail.com>
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU Lesser General Public License as published by
7  * the Free Software Foundation version 2.1 of the License.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17  * Or, point your browser to http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
18  *
19  */
20 
21 /**
22  * @file desc_event_short.h
23  * @ingroup descriptors
24  * @brief Provides the descriptors for the short event descriptor
25  * @copyright GNU Lesser General Public License version 2.1 (LGPLv2.1)
26  * @author Mauro Carvalho Chehab
27  * @author Andre Roth
28  *
29  * @par Relevant specs
30  * The descriptor described herein is defined at:
31  * - ETSI EN 300 468 V1.11.1
32  *
33  * @par Bug Report
34  * Please submit bug reports and patches to linux-media@vger.kernel.org
35  */
36 
37 module libdvbv5_d.desc_event_short;
38 
39 import libdvbv5_d.descriptors: dvb_desc;
40 import libdvbv5_d.dvb_fe: dvb_v5_fe_parms;
41 
42 extern (C):
43 
44 /**
45  * @struct dvb_desc_event_short
46  * @ingroup descriptors
47  * @brief Structure containing the short event descriptor
48  *
49  * @param type			descriptor tag
50  * @param length		descriptor length
51  * @param next			pointer to struct dvb_desc
52  * @param language		ISO 639 language code
53  * @param name			event name string
54  * @param name_emph		event name emphasis string
55  * @param text			event text string
56  * @param text_emph		event text emphasis string
57  *
58  * @details
59  * The emphasis text is the one that uses asterisks. For example, in the text:
60  *	"the quick *fox* jumps over the lazy table" the emphasis would be "fox".
61  */
62 struct dvb_desc_event_short
63 {
64     align (1):
65 
66     ubyte type;
67     ubyte length;
68     dvb_desc* next;
69 
70     ubyte[4] language;
71     char* name;
72     char* name_emph;
73     char* text;
74     char* text_emph;
75 }
76 
77 // struct dvb_v5_fe_parms;
78 
79 /**
80  * @brief Initializes and parses the short event descriptor
81  * @ingroup descriptors
82  *
83  * @param parms	struct dvb_v5_fe_parms pointer to the opened device
84  * @param buf	buffer containing the descriptor's raw data
85  * @param desc	pointer to struct dvb_desc to be allocated and filled
86  *
87  * This function allocates a the descriptor and fills the fields inside
88  * the struct. It also makes sure that all fields will follow the CPU
89  * endianness. Due to that, the content of the buffer may change.
90  *
91  * @return On success, it returns the size of the allocated struct.
92  *	   A negative value indicates an error.
93  */
94 int dvb_desc_event_short_init (
95     dvb_v5_fe_parms* parms,
96     const(ubyte)* buf,
97     dvb_desc* desc);
98 
99 /**
100  * @brief Prints the content of the short event descriptor
101  * @ingroup descriptors
102  *
103  * @param parms	struct dvb_v5_fe_parms pointer to the opened device
104  * @param desc	pointer to struct dvb_desc
105  */
106 void dvb_desc_event_short_print (dvb_v5_fe_parms* parms, const(dvb_desc)* desc);
107 
108 /**
109  * @brief Frees all data allocated by the short event descriptor
110  * @ingroup descriptors
111  *
112  * @param desc pointer to struct dvb_desc to be freed
113  */
114 void dvb_desc_event_short_free (dvb_desc* desc);